﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.ComponentModel;
using Framework.Domain;
using DevExpress.XtraLayout.Utils;
using System.Windows.Forms;
using DevExpress.XtraLayout;

namespace CIIS.Common
{
    public partial class BaseForm : System.Windows.Forms.Form
    {
        public BaseForm()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 当前用户
        /// </summary>
        public Contract.Domain.t_sys_user CurrentUser
        {
            get;
            set;
        }
        EOperateType optType = EOperateType.Add;
        public EOperateType OptType
        {
            get { return optType; }
            set
            {
                optType = value;
                if (OptType == EOperateType.Detail)
                {
                    //修改在详情模式下禁止编辑的状态
                    foreach (Control c in Controls)
                    {
                        if (c is LayoutControl)
                        {
                            foreach (Control lc in c.Controls)
                            {
                                if (!(lc is Button))
                                {
                                    lc.Enabled = false;
                                }
                            }
                        }
                        else if (!(c is Button))
                        {
                            c.Enabled = false;
                        }
                    }
                }
            }
        }

        public DataUtils dao = DataUtils.Instance;

        Entity bindEntity = null;
        public Entity BindEntity
        {
            get { return bindEntity; }
            set { bindEntity = value; }
        }

        public virtual void BindData(Entity entity) { }
    }
}
